home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / ATL_Samples / sketch / sketch.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  1.9 KB  |  78 lines

  1. // Sketch.cpp : Implementation of DLL Exports.
  2.  
  3.  
  4. // Note: Proxy/Stub Information
  5. //        To build a separate proxy/stub DLL, 
  6. //        run nmake -f Sketchps.mk in the project directory.
  7.  
  8. #include "stdafx.h"
  9. #include "resource.h"
  10. #include "initguid.h"
  11. #include "Sketch.h"
  12.  
  13. #include "Sketch_i.c"
  14. #include "SketcCtl.h"
  15.  
  16.  
  17. CComModule _Module;
  18.  
  19. BEGIN_OBJECT_MAP(ObjectMap)
  20.     OBJECT_ENTRY(CLSID_SketcCtl, CSketcCtl)
  21. END_OBJECT_MAP()
  22.  
  23.  
  24. /////////////////////////////////////////////////////////////////////////////
  25. // DLL Entry Point
  26.  
  27. extern "C"
  28. BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  29. {
  30.     if (dwReason == DLL_PROCESS_ATTACH)
  31.     {
  32.         _Module.Init(ObjectMap, (HINSTANCE)hInstance);
  33. //        DisableThreadLibraryCalls(hInstance);
  34.     }
  35.     else if (dwReason == DLL_PROCESS_DETACH)
  36.         _Module.Term();
  37.     return TRUE;    // ok
  38. }
  39.  
  40. /////////////////////////////////////////////////////////////////////////////
  41. // Used to determine whether the DLL can be unloaded by OLE
  42.  
  43. STDAPI DllCanUnloadNow(void)
  44. {
  45.     return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  46. }
  47.  
  48. /////////////////////////////////////////////////////////////////////////////
  49. // Returns a class factory to create an object of the requested type
  50.  
  51. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  52. {
  53.     return _Module.GetClassObject(rclsid, riid, ppv);
  54. }
  55.  
  56.  
  57. /////////////////////////////////////////////////////////////////////////////
  58. // DllRegisterServer - Adds entries to the system registry
  59.  
  60.  
  61. STDAPI DllRegisterServer(void)
  62. {
  63.     // registers object, typelib and all interfaces in typelib
  64.     return _Module.RegisterServer(TRUE);
  65. }
  66.  
  67.  
  68. /////////////////////////////////////////////////////////////////////////////
  69. // DllUnregisterServer - Removes entries from the system registry
  70.  
  71. STDAPI DllUnregisterServer(void)
  72. {
  73.     _Module.UnregisterServer();
  74.     return S_OK;
  75. }
  76.  
  77.  
  78.